package com.imti.mall.product.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.imti.mall.model.cms.pojo.CmsPrefrenceAreaProductRelation;
import com.imti.mall.product.dao.CmsPrefrenceAreaProductRelationDao;
import com.imti.mall.product.service.CmsPrefrenceAreaProductRelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CmsPrefrenceAreaProductRelationServiceImpl extends ServiceImpl<CmsPrefrenceAreaProductRelationDao,CmsPrefrenceAreaProductRelation> implements CmsPrefrenceAreaProductRelationService {
    @Autowired
    CmsPrefrenceAreaProductRelationDao cmsPrefrenceAreaProductRelationDao;
    /**
     * 根据商品id查询优选专区和产品关系表
     * @param id
     * @return
     */
    @Override
    public List<CmsPrefrenceAreaProductRelation> getCmsPrefrenceAreaProductRelationProductId(Integer id) {
        return cmsPrefrenceAreaProductRelationDao.getCmsPrefrenceAreaProductRelationProductId(id);
    }
    /**
     * 添加优选专区和产品关系表
     * @param cmsPrefrenceAreaProductRelation
     * @return
     */
    @Override
    public Integer addCmsPrefrenceAreaProductRelation(CmsPrefrenceAreaProductRelation cmsPrefrenceAreaProductRelation) {
        return cmsPrefrenceAreaProductRelationDao.insert(cmsPrefrenceAreaProductRelation);
    }

    @Override
    public boolean addList(List<CmsPrefrenceAreaProductRelation> list) {
        return saveBatch(list);
    }

    @Override
    public boolean updateList(List<CmsPrefrenceAreaProductRelation> list) {
        return saveOrUpdateBatch(list);
    }

    @Override
    public boolean deleteList(List<CmsPrefrenceAreaProductRelation> list) {
        return removeByIds(list);
    }
}
